package cn.ybk.user.controller;

import cn.ybk.basic.util.AjaxResult;
import cn.ybk.user.dto.WechatBinderDto;
import cn.ybk.user.dto.WechatDto;
import cn.ybk.user.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/login")
public class LoginController {

    @Autowired
    private LoginService loginService;

    // 微信扫码接口
    @PostMapping("/wechat")
    public AjaxResult wechat(@RequestBody @Valid WechatDto dto){
        return loginService.wechat(dto);
    }

    // 微信绑定
    @PostMapping("/wechat/binder")
    public AjaxResult wechatBinder(@RequestBody @Valid WechatBinderDto dto){
         return loginService.wechatBinder(dto);
    }




}
